<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<script>
    function ajax(url){
        return new Promise((resolve,reject)=>{
            let xhr = new  XMLHttpRequest()
        xhr.open('get',url)
    xhr.send()
    xhr.onreadystatechange = function(){
        console.log(xhr);
        if (xhr.readyState === 4){
            if(xhr.Status >= 200 && xhr.Statusv < 300){
                let res = JSON.parse(xhr.responseText)
                resolve(res)

            }
            else{
                reject()
            }
        }
    }
})
    }
    ajax('/01.json')
    .then(res=>{
        console.log(res);
    })
    .catch(err=>{
        console.log(err);
    })
</script>
    
</body>
</html>